/*
题目：不用加减乘除做加法
 */
public class Offer65 {
    public int add(int a, int b) {
        int sum = a ^ b;  //不进位相加
        int carry = (a & b) << 1; //只考虑进位
        while(carry != 0){
            int x = sum;
            int y = carry;
            sum = x ^ y;
            carry = (x & y) << 1;
        }
        return sum;
    }
}
